package icu.ac.kr.phonebook.provider;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;

import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import android.util.Log;

public class PacelableObject2 implements Parcelable {

	public HashSet<Integer> removed;
	
	public PacelableObject2(){}
	
	public PacelableObject2 (HashSet<Integer> orig)
	{
		removed = orig;
		
	}
	
	public int describeContents() {
		// TODO Auto-generated method stub
		return 0;
	}

	public void writeToParcel(Parcel dest, int flags) {
		// TODO Auto-generated method stub

		dest.writeInt(removed.size());
		
		Iterator<Integer> it = removed.iterator();
		while(it.hasNext())
		{
			dest.writeInt(it.next());
			
			
		}
		
	}

	public static final Creator<PacelableObject2> CREATOR = new Creator<PacelableObject2>() 
	{          

		public PacelableObject2 createFromParcel(Parcel source) 
		{              
			
			PacelableObject2 deletedHashSetPacel = new PacelableObject2();
			deletedHashSetPacel.removed = new HashSet<Integer>();
			
			int size = source.readInt();

	 		for (int i = 0; i < size ; i++)
			{
				int key = source.readInt();
				deletedHashSetPacel.removed.add(key);
	 				
			}
	 			           
			return deletedHashSetPacel;
		}

		public PacelableObject2[] newArray(int arg0) {
			// TODO Auto-generated method stub
			Log.d("PARCEL", "new Array called");
			
			return null;
		}

	};
	

	
	
	
}
